<template>
	<view >
		<view class="bgbox">
			<image @click="tomy()" class="wd" src="../../static/wd.png"></image>
			<image src="../../static/index3.jpg"></image>
		</view>
		<view class="butbox">
			<view class="butbg" @click="tourl()">
				答题开始
			</view>
		</view>
		<view class="modelbox" v-if="modelbox">
			<view>{{p_road_name}}</view>
			<view >{{huanying}}</view>
		</view>
		<view class="box_12" v-if="magstatus">
			<view class="rolebg">
				<view class="closen" @click="magstatus=false">
					<image src="../../static/closen1.png" mode="" class="image"></image>
				</view>
				<view style="text-align: center; font-size: 34rpx;font-weight: bold;margin: 50rpx 0 50rpx 0;">前言</view>
				<view class="infobox">
					<view style="text-indent:30px;text-align:justify;text-align-last:left;">
						&nbsp;为着力解决公众关注的服务热点、出行痛点等问题，不断提升公众对江西交投集团<text style="color: #197DD7;">“高速映山红”</text>品牌的满意度，路网运营管理公司现向您发出邀请，对高速公路的行车安全、文明施工以及应急救援水平、安全保畅能力、客户服务水平等方面进行评价。
					</view>
					<view style="margin-top: 20rpx;text-indent:30px;text-align:justify;text-align-last:left;">
						&nbsp;本次公众满意度调查问卷活动，通过采取有奖问答方式，只要您积极参与，就有机会获得话费奖励，您的意见将对提升服务品质满足美好出行起到重要参考作用，请提出您宝贵的意见，感谢您的支持！
					</view>
				</view>
			</view>
		</view>
		<!-- 活动结束弹窗 -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				magstatus:false,
				token:uni.getStorageSync('token')||'',
				info:uni.getStorageSync('userInfo'),
				text:'',
				idlebgth:'',
				test:'',
				is_answer:'',
				// url:window.location.href
				url:'',
				ids:'',
				admin_id:'',
				p_road_name:'',
				huanying:'',
				modelbox:false,
			}
		},
		onLoad() {
			
			// this.url='http://wjdc.zxkjnc.com/h5?admin_id=55&p_road_id=1'
			// console.log(this.$route.query,this.$route.query.admin_id)
			// this.url =window.location.href
			if(window.location.href.includes("admin_id")){
				console.log(this.$route.query)
				uni.setStorageSync('admin_id', this.$route.query.admin_id);
				uni.setStorageSync('ids', this.$route.query.p_road_id);
				uni.setStorageSync('p_road_name', this.$route.query.p_road_name);
				this.admin_id = this.$route.query.admin_id
				this.ids = this.$route.query.p_road_id
				this.p_road_name = this.$route.query.p_road_name
				this.huanying = this.$route.query.huanying
				console.log(this.p_road_name,this.ids,this.admin_id)
				if(this.p_road_name){
					this.modelbox = true
				}
				setTimeout(()=>{
				this.modelbox = false
				},3000)
				
				// setTimeout(()=>{
				// 	uni.showToast({
				// 		title:this.p_road_name+'\n'+this.huanying,
				// 		icon:'none',
				// 		duration:3000
				// 	})
				// })
				// this.text = window.location.href.split('=')[1]
				// this.idlebgth = this.text.length
				// this.test = this.text.slice(0, this.idlebgth)
				// if(this.test.includes("#")){
				// 	this.test = this.test.substring(0,this.test.lastIndexOf("#"))
				// }
				// uni.setStorageSync('admin_id', this.test);
				// console.log(this.text,this.test,'admin_id')
				// console.log(this.admin_id,this.$route.query.admin_id,this.$route.query,uni.getStorageSync('admin_id'))
				// return
			}
			// if(!uni.getStorageSync('token')||!this.token){
			// 	this.magstatus = true
			// }else{
				
			// }
			// this.getmyinfo()
		},
		onShow() {
			if(this.token||uni.getStorageSync('token')){
				// window.location.href = 'http://wjdc.zxkjnc.com/h5/#/';
				
			}else{
				this.magstatus = true
			}
			console.log(this.token,'this.token')
			
			// setTimeout(()=>{
			// 	uni.showToast({
			// 		title:'弄好'+'\r\n'+'第三方',
			// 		icon:'none',
			// 		duration:3000
			// 	})
			// })
		},
		methods: {
			tourl(){
				this.getmyinfo()
				if(this.is_answer==2){//是否答题1否2是
					uni.showToast({
						title:'您已答过题',
						icon:'none'
					})
					return
				}else{
					uni.navigateTo({
						url:'/pages/answerinfo/answerinfo'
					})
				}
				// uni.navigateTo({
				// 	url:'/pages/answerinfo/answerinfo'
				// })
				// this.getmyinfo()
				
			},
			//获取信息
			async getmyinfo(){
				await this.$http({
					url:'api/Answer/user_info',
					data:{
						token:uni.getStorageSync('token')
					}
				}).then(res=>{
					this.is_see_qy = res.data.is_see_qy//is_see_qy 1未查看2已查看
					this.is_answer = res.data.is_answer//是否答题1否2是
					
					if(this.is_see_qy==1){
						this.magstatus = true
					}else{
						this.magstatus = false
					}
					if(!res.admin_id){
						// console.log(this.admin_id,this.$route.query.admin_id,this.$route.query,uni.getStorageSync('admin_id'))
						this.bindid()
					}
					setTimeout(()=>{
					this.modelbox = false
					},3000)
					
					// if(this.is_answer==2){//是否答题1否2是
					// 	uni.showToast({
					// 		title:'您已答过题',
					// 		icon:'none'
					// 	})
					// 	return
					// }else{
					// 	uni.navigateTo({
					// 		url:'/pages/answerinfo/answerinfo'
					// 	})
					// }
				})
			},
			//绑定
			bindid(){
				this.$http({
					url:'api/answer/bind_admin',
					data:{
						admin_id:uni.getStorageSync('admin_id'),
						p_road_id:uni.getStorageSync('ids')||'',
						token:uni.getStorageSync('token')
					}
				}).then(res=>{
					
				})
			},
			checkinfo(){
				this.$http({
					url:'api/answer/update_qy',
					data:{
						token:uni.getStorageSync('token')
					}
				}).then(res=>{
					this.magstatus = false
				})
			},
			tomy(){
				this.getmyinfo()
				uni.navigateTo({
					url:'/pages/my/my'
				})
			},
			// 退出登录
			   handleLogout() {
			    uni.showModal({
			      title: '友情提示',
			      content: '是否清除缓存?',
			      success:(res)=> {
			        if (res.confirm) {
			      uni.clearStorage()
			      uni.reLaunch({
			       url: '/pages/index/index'
			      });
			        }
			      }
			    })
			    
			   },
		}
	}
</script>

<style>
	page{
		/* background-color: #008fd6; */
		background: linear-gradient(-89deg, #008fd6, #3ba3ed);
	}
</style>
<style lang="scss" scoped>
	.bgbox{
		width: 750rpx;
		height: 1956rpx;
		
		image{
			width: 750rpx;
			height: 1956rpx;
		}
		.wd{
			width: 146rpx;
			height: 66rpx;
			position: absolute;
			top: 100rpx;
			right: 0;
			z-index: 8;
		}
	}
	.butbox{
		width: 100%;
		margin: 50rpx 0 40rpx 0;
		padding-bottom: 30rpx;
		
		.butbg{
			background: url(http://wjdc.zxkjnc.com/images/but.png) no-repeat;
			width: 669rpx;
			height: 89rpx;
			background-size:669rpx 89rpx;
			margin: 0 auto;
			font-size: 38rpx;
			font-family: Source Han Sans CN;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 89rpx;
			text-align: center;
		}
	}
	.box_12{
		display: flex;
		width: 750rpx;
		height: 100vh;
		flex-flow: column;
		justify-content: center;
		align-items: center;
		background: rgba(0, 0, 0, 0.5);
		position: fixed;
		top: 0;
		left: 0;
		z-index: 9999;
		.rolebg{
			width: 680rpx;
			min-height: 650rpx;
			border-radius: 20rpx;
			background-color: #FFF;
			position: relative;
			padding-bottom: 50rpx;
			// position: relative;
			background-image: url(http://wjdc.zxkjnc.com/images/hllhp.png);
			background-size: 680rpx 100%;
			.bgbox{
				width: 680rpx;
				position: absolute;
				display: flex;
				justify-content: space-between;
			}
			.closen{
				position: absolute;
				text-align: right;
				width: 680rpx;
				margin-top: -25rpx;
				display: flex;
				justify-content: flex-end;
				z-index: 99;
				// margin-bottom: 20rpx;
				// .butbox{
				// 	width: fit-content;
				// 	padding: 10rpx 20rpx;
				// 	background-color: #3583d5;
				// 	color: #FFF;
				// 	border-radius: 20rpx;
				// 	font-size: 26rpx;
				// }
				image {
					width: 50rpx;
					height: 50rpx;
				}
			}
			.infobox{
				width: 620rpx;
				margin: 0 auto;
				font-size: 28rpx;
				font-family: Source Han Sans CN;
				font-weight: 500;
				color: #222222;
			}
			.awordsinfo{
				width: 630rpx;
				margin-top: 30rpx;
				margin-left: 30rpx;
				color: #FFF;
				.svalueinfo{
					width: 600rpx;
				}
			}
		}
		.timebox{
			width: 690rpx;
			min-height: 250rpx;
			border-radius: 20rpx;
			background-color: #FFF;
			position: relative;
			padding-bottom: 50rpx;
			// position: relative;
			background-image: url(http://wjdc.zxkjnc.com/images/hllhp.png);
			background-size: 680rpx 100%;
			.bgbox{
				width: 680rpx;
				position: absolute;
				display: flex;
				justify-content: space-between;
			}
			.closen{
				position: absolute;
				text-align: right;
				width: 680rpx;
				margin-top: -25rpx;
				display: flex;
				justify-content: flex-end;
				z-index: 99;
				// margin-bottom: 20rpx;
				// .butbox{
				// 	width: fit-content;
				// 	padding: 10rpx 20rpx;
				// 	background-color: #3583d5;
				// 	color: #FFF;
				// 	border-radius: 20rpx;
				// 	font-size: 26rpx;
				// }
				image {
					width: 50rpx;
					height: 50rpx;
				}
			}
			.infobox{
				width: 620rpx;
				margin: 0 auto;
				font-size: 28rpx;
				font-family: Source Han Sans CN;
				font-weight: 500;
				color: #222222;
			}
			.awordsinfo{
				width: 630rpx;
				margin-top: 30rpx;
				margin-left: 30rpx;
				color: #FFF;
				.svalueinfo{
					width: 600rpx;
				}
			}
		}
	}
	.modelbox{
		display: flex;
		width: 600rpx;
		padding: 18rpx 0;
		flex-flow: column;
		justify-content: center;
		align-items: center;
		background: rgba(0, 0, 0, 0.6);
		position: fixed;
		top: 500rpx;
		left: 0;
		z-index: 99999;
		color: #FFF;
		left: 50%;
		transform: translate(-50%,0);
		border-radius: 10rpx;
	}

</style>
